package me.liuyu.ymall.member.oauth;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
import org.springframework.cloud.openfeign.EnableFeignClients;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.ComponentScans;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.config.annotation.web.builders.HttpSecurity;
import org.springframework.security.config.annotation.web.configuration.WebSecurityConfigurerAdapter;

/**
 * @Author liuyu E-mail: liuyu2783@163.com
 * @Date 2018/5/24 20:20
 * @Descrption
 * @Modified By
 */

@SpringBootApplication(exclude = DataSourceAutoConfiguration.class)
@ComponentScans({@ComponentScan("me.liuyu.ymall.config")})
@EnableDiscoveryClient
@EnableFeignClients({"me.liuyu.ymall.member.point.client"})
public class MemberOauthServiceApplication {

	public static void main(String[] args) {
		SpringApplication.run(MemberOauthServiceApplication.class, args);
	}

	@Configuration
	public static class SecurityPermitAllConfig extends WebSecurityConfigurerAdapter {
		@Override
		protected void configure(HttpSecurity http) throws Exception {
			http.authorizeRequests().anyRequest().permitAll()
					.and().csrf().disable();
		}
	}
}
